import React, { PureComponent } from 'react'
import { StyleSheet, View, Text, Image, TouchableOpacity } from 'react-native'
import screen from '../../../../common/screen'
import { Title, SaleNum, Earn, Price } from '../../../../widget/Text';
type Props = {
    info: Object,//商品信息
    onPress: Function//点击事件
}


class RecommendMoreItem extends PureComponent<{}>{
    render() {

        let info = this.props.info

        return (
            <TouchableOpacity style={styles.contain} onPress={()=>this.props.onPress(info.id)}>
                <Image source={{ uri: info.imageUrl, cache: 'force-cache' }} style={styles.image} />
                <View style={styles.textView}>
                    <Title numberOfLines={2}>{info.title}</Title>
                    <View flexDirection={'row'} >
                        <SaleNum>{info.buyNum}人已买</SaleNum>
                        <Earn >收益{info.earn}</Earn>
                    </View>
                    <View flexDirection={'row'} marginTop={7}>
                        <Image style={styles.memberPrice} resizeMode='contain' source={require('../../../../img/home/member_price.png')} />
                        <Price>¥{info.price}</Price>
                    </View>
                </View>
            </TouchableOpacity>
        );
    }
}
const styles = StyleSheet.create({
    contain: {
        width: screen.width,
        height: screen.width * 0.225,
        backgroundColor: 'white',
        flexDirection: 'row',
        justifyContent: 'flex-start',
        alignItems: 'center',
    },
    image: {
        width: screen.width * 0.194,
        height: screen.width * 0.194,
        marginLeft: 19,
        marginTop:12,
        marginBottom:7,
    },
    textView: {
        justifyContent: 'center',
        alignItems: 'flex-start',
        marginTop: 10,
        marginBottom: 10,
        marginLeft: 15,
        marginRight: 60,
    },
    memberPrice: {
        width: screen.width * 0.12,
        height: screen.width * 0.048,
        marginRight: 5,
    },
})
export default RecommendMoreItem